Main Text - Figure 4
In this plot we will calculate the absolute abundance of methane cyclers in water column and the relative abundance in sediments to see methane cyclers overtime and with a box plot to show abundance as well.
There is probably a better way to do this but I individually plotted surface, bottom, sediment depths for each methanogen and methanotroph for overtime and box plots.
For the water column cell counts we will demonstrate this by thousand cells per ml
# water over time plot
# 1. lets plot surface water
# surface methanogens
methanogen_surfwater24 <- methano_water_df %>%
dplyr::filter(Depth_Class == "Surface Water",
Methanotroph_Methanogen == "Methanogen") %>%
group_by(JDate, Pond, solar_progress, total_cells_ml, Methanotroph_Methanogen) %>%
ggplot(aes(x = JDate, y = total_cells_ml/1e3, color = solar_progress))+
geom_line(aes(group = interaction(Pond, Methanotroph_Methanogen)),
alpha = 0.2) +
geom_smooth(aes(group = solar_progress), se = FALSE) +
geom_point(aes(shape = Pond), size = 2) +
#ggh4x::facet_grid2(~Methanotroph_Methanogen, scales = "free_y") +
scale_color_manual(values = solar_colors) +
scale_shape_manual(values = pond_shapes) +
scale_x_continuous(
breaks = seq(180, 240, by = 20), # even ticks
limits = c(170, 260)) +
labs(
x = NULL,
y = "Surface Water\n(10³ cells/ml)"
) +
theme_classic() +
theme(
axis.title.y = element_text(size = 8),
legend.position = "none"
) +
guides(color = "none", shape = "none")
methanogen_surfwater24
# surface methanotrophs
methanotrophs_surfwater24 <- methano_water_df %>%
dplyr::filter(Depth_Class == "Surface Water",
Methanotroph_Methanogen == "Methanotroph") %>%
group_by(JDate, Pond, solar_progress, total_cells_ml, Methanotroph_Methanogen) %>%
ggplot(aes(x = JDate, y = total_cells_ml/1e3, color = solar_progress))+
geom_line(aes(group = interaction(Pond, Methanotroph_Methanogen)),
alpha = 0.2) +
geom_smooth(aes(group = solar_progress), se = FALSE) +
geom_point(aes(shape = Pond), size = 2) +
#ggh4x::facet_grid2(~Methanotroph_Methanogen, scales = "free_y") +
scale_color_manual(values = solar_colors) +
scale_shape_manual(values = pond_shapes) +
scale_x_continuous(
breaks = seq(180, 240, by = 20), # even ticks
limits = c(170, 260)) +
labs(
x = NULL,
y = "Surface Water\n(10³ cells/ml)"
) +
theme_classic() +
theme(
axis.title.y = element_text(size = 8),
legend.position = "none"
) +
guides(color = "none", shape = "none")
methanotrophs_surfwater24
# now bottom water methanogens
methanogen_bot_water24 <- methano_water_df %>%
dplyr::filter(Depth_Class == "Bottom Water",
Methanotroph_Methanogen == "Methanogen") %>%
group_by(JDate, Pond, solar_progress, total_cells_ml, Methanotroph_Methanogen) %>%
ggplot(aes(x = JDate, y = total_cells_ml/1e3, color = solar_progress))+
geom_line(aes(group = interaction(Pond, Methanotroph_Methanogen)),
alpha = 0.2) +
geom_smooth(aes(group = solar_progress), se = FALSE) +
geom_point(aes(shape = Pond), size = 2) +
#ggh4x::facet_grid2(~Methanotroph_Methanogen, scales = "free_y") +
scale_color_manual(values = solar_colors) +
scale_shape_manual(values = pond_shapes) +
scale_x_continuous(
breaks = seq(180, 240, by = 20), # even ticks
limits = c(170, 260)) +
labs(
x = NULL,
y = "Bottom Water\n(10³ cells/ml)"
) +
theme_classic() +
theme(
axis.title.y = element_text(size = 8),
legend.position = "none"
) +
guides(color = "none", shape = "none")
methanogen_bot_water24
# bottom methanotrophs
methanotroph_bot_water24 <- methano_water_df %>%
dplyr::filter(Depth_Class == "Bottom Water",
Methanotroph_Methanogen == "Methanotroph") %>%
group_by(JDate, Pond, solar_progress, total_cells_ml, Methanotroph_Methanogen) %>%
ggplot(aes(x = JDate, y = total_cells_ml/1e3, color = solar_progress))+
geom_line(aes(group = interaction(Pond, Methanotroph_Methanogen)),
alpha = 0.2) +
geom_smooth(aes(group = solar_progress), se = FALSE) +
geom_point(aes(shape = Pond), size = 2) +
#ggh4x::facet_grid2(~Methanotroph_Methanogen, scales = "free_y") +
scale_color_manual(values = solar_colors) +
scale_shape_manual(values = pond_shapes) +
scale_x_continuous(
breaks = seq(180, 240, by = 20), # even ticks
limits = c(170, 260)) +
labs(
x = NULL,
y = "Bottom Water\n(10³ cells/ml)"
) +
theme_classic() +
theme(
axis.title.y = element_text(size = 8),
legend.position = "none"
) +
guides(color = "none", shape = "none")
methanotroph_bot_water24
# sediment methanogens
methano_sed_24 <- methano_sed_df %>%
filter(Depth_Class == "Sediment",
Methanotroph_Methanogen == "Methanogen") %>%
group_by(JDate, order_abund, Pond, solar_progress, Methanotroph_Methanogen) %>%
ggplot(aes(x = JDate, y = order_abund, color = solar_progress)) +
geom_line(aes(group = interaction(Pond, Methanotroph_Methanogen)),
alpha = 0.2) +
geom_smooth(aes(group = solar_progress), se = FALSE) +
geom_point(aes(shape = Pond), size = 2) +
#ggh4x::facet_grid2(.~Methanotroph_Methanogen, scales = "free_y") +
scale_color_manual(values = solar_colors) +
scale_shape_manual(values = pond_shapes) +
scale_x_continuous(
breaks = seq(180, 240, by = 20), # even ticks
limits = c(170, 260)) +
labs(
x = "Day of Year",
y = "Sediment\nRelative Abundance (%)"
) +
theme_classic() +
theme(
axis.title.y = element_text(size = 8),
legend.position = "none"
) +
guides(color = "none", shape = "none")
methano_sed_24
# sediment methanotroph
methanotroph_sed_24 <- methano_sed_df %>%
filter(Depth_Class == "Sediment",
Methanotroph_Methanogen == "Methanotroph") %>%
# group_by(JDate, order_abund, Pond, solar_progress, Methanotroph_Methanogen) %>%
ggplot(aes(x = JDate, y = order_abund, color = solar_progress)) +
geom_line(aes(group = interaction(Pond, Methanotroph_Methanogen)),
alpha = 0.2) +
geom_smooth(aes(group = solar_progress), se = FALSE) +
geom_point(aes(shape = Pond), size = 2) +
#ggh4x::facet_grid2(.~Methanotroph_Methanogen, scales = "free_y") +
scale_color_manual(values = solar_colors) +
scale_shape_manual(values = pond_shapes) +
scale_x_continuous(
breaks = seq(180, 240, by = 20),
limits = c(170, 260)
) +
labs(
x = "Day of Year",
y = "Sediment\nRelative Abundance (%)"
) +
theme_classic() +
theme(
axis.title.y = element_text(size = 8),
legend.position = "none"
) +
guides(color = "none", shape = "none")
methanotroph_sed_24
# quick plot methanogens
methanogen_surfwater24 / methanogen_bot_water24 / methano_sed_24
# quick plot methanotrophs
methanotrophs_surfwater24 / methanotroph_bot_water24 / methanotroph_sed_24
# box plots by depth and methane cycler
# 1. calculate pvalue for water column all together
stat.test <- methano_water_df %>%
group_by(Methanotroph_Methanogen, Depth_Class) %>%
wilcox_test(total_cells_ml ~ solar_progress,
p.adjust.method = "fdr",
exact = FALSE) %>%
add_significance() %>%
mutate(
group = interaction(Methanotroph_Methanogen, Depth_Class, sep = " "),
y.position = 0.35,
p.label = signif(p, digits = 2))
stat.test
## # A tibble: 4 × 13
## Methanotroph_Methanogen Depth_Class .y. group1 group2 n1 n2 statistic p p.signif group y.position p.label
## <chr> <fct> <chr> <chr> <chr> <int> <int> <dbl> <dbl> <chr> <fct> <dbl> <dbl>
## 1 Methanogen Surface Water total_cells_ml FPV Open 12 12 78.5 0.728 ns Methanogen Surface Water 0.35 0.73
## 2 Methanogen Bottom Water total_cells_ml FPV Open 12 12 80 0.665 ns Methanogen Bottom Water 0.35 0.66
## 3 Methanotroph Surface Water total_cells_ml FPV Open 12 12 119 0.00726 ** Methanotroph Surface Water 0.35 0.0073
## 4 Methanotroph Bottom Water total_cells_ml FPV Open 12 12 116 0.012 * Methanotroph Bottom Water 0.35 0.012
# A. filter for methanogen surface water
stat_gen_surf <- stat.test %>%
filter(Methanotroph_Methanogen == "Methanogen",
Depth_Class == "Surface Water")
# surface methanogen
box_gen_surf <- methano_water_df %>%
dplyr::filter(Depth_Class == "Surface Water",
Methanotroph_Methanogen == "Methanogen") %>%
ggplot(aes(x = solar_progress, y = total_cells_ml/1e3, color = solar_progress)) +
geom_boxplot(outlier.shape = NA, alpha = 0.2, color = "black", position = position_dodge(0.6)) +
geom_point(aes(shape = Pond),
alpha =2,
position = position_jitterdodge(jitter.width = .1, dodge.width = .3),
size = 3) +
# ggh4x::facet_nested(~ solar_progress,
# scales = "free") +
#scale_fill_manual(values = c("FPV" = "#C07A5B", "Open" = "#76A7CB")) +
scale_color_manual(values = c("FPV" = "#C07A5B", "Open" = "#76A7CB")) +
scale_shape_manual(values = pond_shapes) +
# stat_pvalue_manual( # p = 0.73
# stat_gen_surf,
# label = "p.label",
# y.position = 9.5,
# tip.length = 0,
# bracket.size = 0,
# size = 3
# ) +
theme_classic() +
theme(
axis.title.x = element_blank(),
axis.title.y = element_blank(),
axis.line.y = element_blank(),
axis.text.y = element_blank(),
axis.ticks.y = element_blank(),
legend.position = "none"
)
box_gen_surf
# B. filter for methanotroph surface water
stat_troph_surf <- stat.test %>%
filter(Methanotroph_Methanogen == "Methanotroph",
Depth_Class == "Surface Water")
# surface methanotroph
box_troph_surf <- methano_water_df %>%
dplyr::filter(Depth_Class == "Surface Water",
Methanotroph_Methanogen == "Methanotroph") %>%
ggplot(aes(x = solar_progress, y = total_cells_ml/1e3, color = solar_progress)) +
geom_boxplot(outlier.shape = NA, alpha = 0.2, color = "black", position = position_dodge(0.6)) +
geom_point(aes(shape = Pond),
alpha = 2,
position = position_jitterdodge(jitter.width = .1, dodge.width = .3),
size = 3) +
# ggh4x::facet_nested(~ solar_progress,
# scales = "free") +
#scale_fill_manual(values = c("FPV" = "#C07A5B", "Open" = "#76A7CB")) +
scale_color_manual(values = c("FPV" = "#C07A5B", "Open" = "#76A7CB")) +
scale_shape_manual(values = pond_shapes) +
# stat_pvalue_manual( # p = 0.0073
# stat_troph_surf,
# label = "p.label",
# y.position = 1.5, # or set a fixed numeric if you prefer
# tip.length = 0,
# bracket.size = 0,
# size = 2
# ) +
# guides(
# fill = "none",
# color = "none",
# shape = guide_legend(
# nrow = 2,
# byrow = TRUE,
# title.position = "left",
# override.aes = list(size = 2.5))
# ) +
theme_classic() +
theme(
axis.title.x = element_blank(),
axis.title.y = element_blank(),
axis.line.y = element_blank(),
axis.text.y = element_blank(),
axis.ticks.y = element_blank(),
legend.position = "none"
)
box_troph_surf
# B. filter for methanogen bottom water
stat_gen_bot <- stat.test %>%
filter(Methanotroph_Methanogen == "Methanogen",
Depth_Class == "Bottom Water")
# bottom methanogen
box_gen_bot <- methano_water_df %>%
dplyr::filter(Depth_Class == "Bottom Water",
Methanotroph_Methanogen == "Methanogen") %>%
ggplot(aes(x = solar_progress, y = total_cells_ml/1e3, color = solar_progress)) +
geom_boxplot(outlier.shape = NA, alpha = 0.2, color = "black", position = position_dodge(0.6)) +
geom_point(aes(shape = Pond),
alpha = 2,
position = position_jitterdodge(jitter.width = .1, dodge.width = .3),
size = 3) +
# ggh4x::facet_nested(~ solar_progress,
# scales = "free") +
#scale_fill_manual(values = c("FPV" = "#C07A5B", "Open" = "#76A7CB")) +
scale_color_manual(values = c("FPV" = "#C07A5B", "Open" = "#76A7CB")) +
scale_shape_manual(values = pond_shapes) +
# stat_pvalue_manual( # p = 0.66
# stat_gen_bot,
# label = "p.label",
# tip.length = 0,
# y.position = .095,
# size = 2,
# bracket.size = 0,
# inherit.aes = FALSE
# ) +
# guides(
# fill = "none",
# color = "none",
# shape = guide_legend(
# nrow = 2,
# byrow = TRUE,
# title.position = "left",
# override.aes = list(size = 2.5))
# ) +
theme_classic() +
theme(
axis.title.x = element_blank(),
axis.title.y = element_blank(),
axis.line.y = element_blank(),
axis.text.y = element_blank(),
axis.ticks.y = element_blank(),
legend.position = "none"
)
box_gen_bot
# C. filter for methanotroph bottom water
stat_troph_bot <- stat.test %>%
filter(Methanotroph_Methanogen == "Methanotroph",
Depth_Class == "Bottom Water")
# bottom methanotrophs
box_troph_bot <- methano_water_df %>%
dplyr::filter(Depth_Class == "Bottom Water",
Methanotroph_Methanogen == "Methanotroph") %>%
ggplot(aes(x = solar_progress, y = total_cells_ml/1e3, color = solar_progress)) +
geom_boxplot(outlier.shape = NA, alpha = 0.2, color = "black", position = position_dodge(0.6)) +
geom_point(aes(shape = Pond),
alpha = 2,
position = position_jitterdodge(jitter.width = .1, dodge.width = .3),
size = 3) +
# ggh4x::facet_nested(~ solar_progress,
# scales = "free") +
#scale_fill_manual(values = c("FPV" = "#C07A5B", "Open" = "#76A7CB")) +
scale_color_manual(values = c("FPV" = "#C07A5B", "Open" = "#76A7CB")) +
scale_shape_manual(values = pond_shapes) +
# stat_pvalue_manual( # p = 0.012
# stat_troph_bot,
# label = "p.label",
# y.position = 0.75,
# tip.length = 0,
# size = 2,
# bracket.size = 0,
# inherit.aes = FALSE
# ) +
# guides(
# fill = "none",
# color = "none",
# shape = guide_legend(
# nrow = 2,
# byrow = TRUE,
# title.position = "left",
# override.aes = list(size = 2.5))
# ) +
theme_classic() +
theme(
axis.title.x = element_blank(),
axis.title.y = element_blank(),
axis.line.y = element_blank(),
axis.text.y = element_blank(),
axis.ticks.y = element_blank(),
legend.position = "none"
)
box_troph_bot
# 2. calculate pvalue for sediment
stat.test <- methano_sed_df %>%
group_by(Methanotroph_Methanogen, Depth_Class) %>%
wilcox_test(order_abund ~ solar_progress,
p.adjust.method = "fdr",
exact = FALSE) %>%
add_significance() %>%
mutate(
group = interaction(Methanotroph_Methanogen, Depth_Class, sep = " "),
y.position = 0.35,
p.label = signif(p, digits = 2))
stat.test
## # A tibble: 2 × 13
## Depth_Class Methanotroph_Methanogen .y. group1 group2 n1 n2 statistic p p.signif group y.position p.label
## <chr> <chr> <chr> <chr> <chr> <int> <int> <dbl> <dbl> <chr> <fct> <dbl> <dbl>
## 1 Sediment Methanogen order_abund FPV Open 11 12 54 0.479 ns Methanogen Sediment 0.35 0.48
## 2 Sediment Methanotroph order_abund FPV Open 11 12 60 0.735 ns Methanotroph Sediment 0.35 0.74
# D. calculate stats for sediment methanogen
stat_gen_sed <- stat.test %>%
filter(Methanotroph_Methanogen == "Methanogen",
Depth_Class == "Sediment")
# sediment methanogen
box_gen_sed <- methano_sed_df %>%
dplyr::filter(Methanotroph_Methanogen == "Methanogen") %>%
ggplot(aes(x = solar_progress, y = order_abund, color = solar_progress)) +
geom_boxplot(outlier.shape = NA, alpha = 0.2, color = "black", position = position_dodge(0.6)) +
geom_point(aes(shape = Pond),
alpha = 2,
position = position_jitterdodge(jitter.width = .1, dodge.width = .3),
size = 3) +
scale_color_manual(values = c("FPV" = "#C07A5B", "Open" = "#76A7CB")) +
scale_shape_manual(values = pond_shapes) +
# stat_pvalue_manual( # p = 0.48
# stat_gen_sed,
# label = "p.label",
# y.position = 0.3,
# tip.length = 0,
# bracket.size = 0,
# size = 2
# ) +
# guides(
# fill = "none",
# color = "none",
# shape = guide_legend(
# nrow = 2,
# byrow = TRUE,
# title.position = "left",
# override.aes = list(size = 2.5))
# ) +
theme_classic() +
theme(
axis.title.x = element_blank(),
axis.title.y = element_blank(),
axis.line.y = element_blank(),
axis.text.y = element_blank(),
axis.ticks.y = element_blank(),
legend.position = "none"
)
box_gen_sed
# E. calculate stats for sediment methanotroph
stat_troph_sed <- stat.test %>%
filter(Methanotroph_Methanogen == "Methanotroph",
Depth_Class == "Sediment")
# sediment trophs
box_troph_sed <- methano_sed_df %>%
dplyr::filter(Methanotroph_Methanogen == "Methanotroph") %>%
ggplot(aes(x = solar_progress, y = order_abund, color = solar_progress)) +
geom_boxplot(outlier.shape = NA, alpha = 0.2, color = "black", position = position_dodge(0.6)) +
geom_point(aes(shape = Pond),
alpha = 2,
position = position_jitterdodge(jitter.width = .1, dodge.width = .3),
size = 3) +
scale_color_manual(values = c("FPV" = "#C07A5B", "Open" = "#76A7CB")) +
scale_shape_manual(values = pond_shapes) +
# stat_pvalue_manual( # p = 0.74
# stat_troph_sed,
# label = "p.label",
# y.position = .11,
# tip.length = 0,
# size = 2,
# bracket.size = 0,
# inherit.aes = FALSE
# ) +
# guides(
# fill = "none",
# color = "none",
# shape = guide_legend(
# nrow = 2,
# byrow = TRUE,
# title.position = "left",
# override.aes = list(size = 2.5))
# ) +
theme_classic() +
theme(
axis.title.x = element_blank(),
axis.title.y = element_blank(),
axis.line.y = element_blank(),
axis.text.y = element_blank(),
axis.ticks.y = element_blank(),
legend.position = "none"
)
box_troph_sed
# extract legend
legend_plot <- methano_sed_df %>% # dummy plot
dplyr::filter(Methanotroph_Methanogen == "Methanotroph") %>%
ggplot(aes(x = solar_progress, y = order_abund, color = solar_progress)) +
geom_boxplot(outlier.shape = NA, alpha = 0.2, position = position_dodge(0.6)) +
geom_point(aes(shape = Pond),
alpha = 2,
position = position_jitterdodge(jitter.width = .1, dodge.width = .3),
size = 2) +
# ggh4x::facet_nested(~ solar_progress,
# scales = "free") +
#scale_fill_manual(values = c("FPV" = "#C07A5B", "Open" = "#76A7CB")) +
scale_color_manual(values = c("FPV" = "#C07A5B", "Open" = "#76A7CB")) +
scale_shape_manual(values = pond_shapes) +
# stat_pvalue_manual(
# stat_troph_sed,
# label = "p.label",
# y.position = .11,
# tip.length = 0,
# size = 2,
# bracket.size = 0,
# inherit.aes = FALSE
# ) +
guides(
fill = "none",
color = "none",
shape = guide_legend(
nrow = 2,
byrow = TRUE,
title.position = "left",
override.aes = list(size = 2.5))
) +
theme_classic() +
theme(
legend.position = "bottom",
legend.title = element_text(hjust = 0.5),
legend.box = "horizontal",
legend.justification = "center"
)
legend_plot
legend_only <- ggpubr::get_legend(legend_plot) # extract legend
# now we will need to add it to sediments to plot legend only wont plot by itself
sed_depths_leg <- ggarrange(methano_sed_24, box_gen_sed, methanotroph_sed_24, box_troph_sed,
ncol = 2,
nrow = 3,
legend_only,
align = "hv"
)
# Display
sed_depths_leg
# or lets try two (technically 4 columns) where on the left we have methanogens and right is methanotrophs. they will still be going from surface, bottom, sediments with box plot on the right but we will have a box around methanogens and methanotrophs
# 1. plot final methanogens
methanogen_final <-
ggarrange(methanogen_surfwater24, box_gen_surf,
methanogen_bot_water24, box_gen_bot,
methano_sed_24, box_gen_sed,
nrow = 3,
ncol = 2,
align = "hv",
labels = c("A.", "B.", "C.", "D.", "E.", "F."),
font.label = list(size =10),
widths = c(1, .5))
methanogen_final
# want to add space for title in methanogen plot
space <- nullGrob()
# now plot with extra space
methanogen_final <- ggarrange(
space,
methanogen_final,
ncol = 1,
heights = c(0.1, 1)
)
# 2. draw box around methanogens
png("figures/fig4/methanogens.png", width = 4000, height = 4000, res = 600)
grid.newpage()
grid.draw(methanogen_final)
grid.rect(gp = gpar(col = "black", fill = NA, lwd = 2)) # draw border
grid.text(label = "Methanogens", x = 0.5, y = 0.99, just = c("center", "top"),
gp = gpar(fontface = "bold", cex = .9))
dev.off()
## quartz_off_screen
## 2
# 1. plot final methanotrophs
methanotroph_final <-
ggarrange(methanotrophs_surfwater24, box_troph_surf,
methanotroph_bot_water24, box_troph_bot,
methanotroph_sed_24, box_troph_sed,
nrow = 3,
ncol = 2,
align = "hv",
labels = c("G.", "H.", "I.", "J.", "K.", "L."),
font.label = list(size =10),
widths = c(1, .5))
methanotroph_final
# want to add space for title in methanogen plot
space <- nullGrob()
# now plot with extra space
methanotroph_final <- ggarrange(
space,
methanotroph_final,
ncol = 1,
heights = c(0.09, 1)
)
methanotroph_final
# 2. draw box around methanogens
png("figures/fig4/methanotrophs.png", width = 4000, height = 4000, res = 600)
grid.newpage()
grid.draw(methanotroph_final)
grid.rect(gp = gpar(col = "black", fill = NA, lwd = 2)) # draw border
grid.text(label = "Methanotrophs", x = 0.5, y = 0.99, just = c("center", "top"),
gp = gpar(fontface = "bold", cex = .9))
dev.off()
## quartz_off_screen
## 2
# then i was planning on exporting these images and putting them together in Illustrator
now we have created our main text figure. the only thing is that i dont have the p values in the figure because nick has his italicized and sized a certain way and i want to make sure our plot aesthetics match.